package model

import (
	"gorm.io/gorm"
	"time"
)

type Product struct {
	ProdId             uint           `gorm:"primary_key;AUTO_INCREMENT;" json:"prodId"`                     //商品ID
	ProdName           string         `gorm:"type:varchar(300);not null;" json:"prodName"`   //商品名称
	ShopId             uint           `gorm:"type:bigint;not null;comment:店铺ID" json:"-"`    //店铺ID
	OriPrice           float64        `gorm:"type:decimal(15,2)" json:"oriPrice"`            //原价
	Price              float64        `gorm:"type:decimal(15,2)" json:"price"`               //现价
	Brief              string         `gorm:"type:varchar(500)" json:"brief"`                //简要描述,卖点等
	Content            string         `gorm:"type:text;comment:公告内容" json:"content"`         //详细描述
	Imgs               string         `gorm:"type:varchar(1000)" json:"imgs"`                //商品图片
	Status             int            `gorm:"type:tinyint;not null;default:2" json:"status"` //状态
	CategoryId         string         `gorm:"type:varchar(50)" json:"categoryId"`            //类目ID
	SoldNum            uint           `gorm:"type:int(11)" json:"soldNum"`                   //已经销售数量
	TotalStocks        uint           `gorm:"type:int(11)" json:"totalStocks"`               //库存量
	DeliveryMode       string         `gorm:"type:varchar(11)" json:"deliveryMode"`          //配送方式id已逗号分割
	DeliveryTemplateId uint           `gorm:"type:bigint(20)" json:"deliveryTemplateId"`     //运费模板id
	SkuTags            string         `gorm:"type:varchar(1000)" json:"skuTags"`             //商品规格                                      //商品规格
	Version            int            `gorm:"type:int(11)" json:"-"`                         //版本
	PutawayAt          time.Time      `json:"-"`                                             //上架时间
	SkuList            []Sku          `gorm:"many2many:prod_sku" json:"skuList"`             // sku列表
	CreatedAt          time.Time      `json:"-"`
	UpdatedAt          time.Time      `json:"-"`
	DeletedAt          gorm.DeletedAt `gorm:"index" json:"-"`
	//DeliveryMode       string    `gorm:"type:json" json:"deliveryMode"`                       //配送方式json
}

func (Product) TableName() string {
	return "tz_prod"
}
